package com.smart.mip.system.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;


/**
 * create by scaffold 2017-07-18 
 * @author codefan@sina.com
 
  用户角色设定null   
*/
@Entity
@Table(name = "F_USER_ROLE")
public class UserRole implements java.io.Serializable {
	private static final long serialVersionUID =  1L;



	/**
	 * 用户角色代码 null 
	 */
	@Id
	@Column(name = "UR_CODE")
	@GeneratedValue(generator = "assignedGenerator")
	@GenericGenerator(name = "assignedGenerator", strategy = "uuid")
	private String urCode;

	/**
	 * 用户代码 null 
	 */
	@Column(name = "USER_CODE")
	@Length(max = 32, message = "字段长度不能大于{max}")
	private String  userCode;
	/**
	 * 角色代码 null 
	 */
	@Column(name = "ROLE_CODE")
	@Length(max = 32, message = "字段长度不能大于{max}")
	private String  roleCode;
	/**
	 * 创建时间 null 
	 */
	@Column(name = "Create_Date")
	private Date  createDate;


	// Constructors
	/** default constructor */
	public UserRole() {
		super();
	}
	/** minimal constructor */
	public UserRole(
		String urCode		
		) {
	
	
		this.urCode = urCode;		
			
	}

/** full constructor */
	public UserRole(
	 String urCode		
	,String  userCode,String  roleCode,Date  createDate) {
	
	
		this.urCode = urCode;		
	
		this.userCode= userCode;
		this.roleCode= roleCode;
		this.createDate= createDate;		
	}
	

  
	public String getUrCode() {
		return this.urCode;
	}

	public void setUrCode(String urCode) {
		this.urCode = urCode;
	}
	// Property accessors
  
	public String getUserCode() {
		return this.userCode;
	}
	
	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
  
	public String getRoleCode() {
		return this.roleCode;
	}
	
	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}
  
	public Date getCreateDate() {
		return this.createDate;
	}
	
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	
public UserRole copy(UserRole other){
  
		this.setUrCode(other.getUrCode());
  
		this.userCode= other.getUserCode();  
		this.roleCode= other.getRoleCode();  
		this.createDate= other.getCreateDate();

		return this;
	}
	
	public UserRole copyNotNullProperty(UserRole other){
  
	if( other.getUrCode() != null){
	this.setUrCode(other.getUrCode());}
  
		if( other.getUserCode() != null)
			this.userCode= other.getUserCode();  
		if( other.getRoleCode() != null)
			this.roleCode= other.getRoleCode();  
		if( other.getCreateDate() != null)
			this.createDate= other.getCreateDate();		

		return this;
	}

	public UserRole clearProperties(){
  
		this.userCode= null;  
		this.roleCode= null;  
		this.createDate= null;

		return this;
	}
}
